#ifndef CPCWINDOW_H
#define CPCWINDOW_H

#include <QtGui>
#include <QGraphicsScene>
#include <QMainWindow>
#include <QtXml>
#include "spritetypedef.h"
#include "spritedata.h"
#include "graphictile.h"
#include "imagedata.h"
#include <vector>

namespace Ui {
class CpcWindow;
}

class CpcWindow : public QMainWindow
{
    Q_OBJECT
    
public:
    explicit CpcWindow(QWidget *parent = 0);
    ~CpcWindow();
    
    QString lastdir;
private slots:
    void openCellProject();
    void convertImage();
    void convertImageSplit();
    void convertSprite();

    void cexit();

private:
    Ui::CpcWindow *ui;

    QGraphicsScene scene;
    QVector<GraphicTile*>** tile_vct;

    // 数据始
    int image_num;
    ImageData* images;
    int sprite_num;
    SpriteData* sprites;

    // 数据终

    void clearWorkSpace();
    void loadXml(QDomDocument &cpxml);

    int getSmallest2exp(int n);
};

#endif // CPCWINDOW_H
